﻿using System;
using LF.Domain.Entities;
using System.Collections.Generic;

namespace LF.Domain
{
    public class DomainConfig
    {
        internal static string Connection { get; set; }

        internal static string TargetConnection { get; set; }
        /// <summary>
        /// 系统配置规则
        /// </summary>
        public static RuleConfig Rule { get; set; }
        /// <summary>
        /// 系统字典项
        /// </summary>
        public static List<AppDic> AppDics { get; set; }
        /// <summary>
        /// sql xml路径
        /// </summary>
        public static string SqlXml {get;set;}
        
        /// <summary>
        /// 当前登录用户ID
        /// </summary>
        public static Guid CurrentUserId { get; set; } = Guid.Empty;

        /// <summary>
        /// Ollama配置
        /// </summary>
        public static OllamaConfig OllamaConfig { get; set; } = new OllamaConfig();
        
        /// <summary>
        /// OpenAI配置
        /// </summary>
        public static OpenAIConfig OpenAIConfig { get; set; } = new OpenAIConfig();
        
        /// <summary>
        /// 文件路径信息
        /// </summary>
        public static string FilePath { get; set; } = "/app/files";
        
        /// <summary>
        /// Qdrant向量数据库配置
        /// </summary>
        public static QdrantConfig QdrantConfig { get; set; } = new QdrantConfig();
    }
    public class RuleConfig
    {
        public Rule Rule { get; set; }
    }

    /// <summary>
    /// Ollama服务配置
    /// </summary>
    public class OllamaConfig
    {
        /// <summary>
        /// Ollama API基础URL
        /// </summary>
        public string BaseUrl { get; set; } = "http://localhost:11434";
        
        /// <summary>
        /// 嵌入模型名称
        /// </summary>
        public string ModelName { get; set; } = "nomic-embed-text";
        
        /// <summary>
        /// LLM模型名称
        /// </summary>
        public string LlmModelName { get; set; } = "llama3";
    }
    
    /// <summary>
    /// OpenAI服务配置
    /// </summary>
    public class OpenAIConfig
    {
        /// <summary>
        /// API密钥
        /// </summary>
        public string ApiKey { get; set; }
        
        /// <summary>
        /// API基础URL
        /// </summary>
        public string BaseUrl { get; set; } = "https://api.openai.com";
        
        /// <summary>
        /// 嵌入模型名称
        /// </summary>
        public string EmbeddingModel { get; set; } = "text-embedding-3-small";
        
        /// <summary>
        /// 聊天模型名称
        /// </summary>
        public string ChatModel { get; set; } = "gpt-3.5-turbo";
    }

    /// <summary>
    /// Qdrant配置
    /// </summary>
    public class QdrantConfig
    {
        /// <summary>
        /// 服务器地址
        /// </summary>
        public string Host { get; set; } = "localhost";
        
        /// <summary>
        /// 端口
        /// </summary>
        public int Port { get; set; } = 6334;
        
        /// <summary>
        /// 是否使用HTTPS
        /// </summary>
        public bool UseHttps { get; set; } = false;
        
        /// <summary>
        /// API密钥
        /// </summary>
        public string ApiKey { get; set; } = "";
        
        /// <summary>
        /// 向量维度
        /// </summary>
        public int VectorSize { get; set; } = 1536;
    }
}

